/*****************************************************************************
*
*  PROJECT:     SlipStream
*               (Thread Classes)
*  LICENSE:     GNU General Public License v3 - http://www.gnu.org/licenses/gpl.html

*  DEVELOPERS:  Philip Farquharson 	<B00137077@studentmail.uws.ac.uk>
*				John Gray 			<B00145524@studentmail.uws.ac.uk>		
*				Zohaib Bhatti		<B00104280@studentmail.uws.ac.uk>
*				Euan Hislop 		<B00138636@studentmail.uws.ac.uk>
*
*****************************************************************************/
#ifndef CTHREAD_H
#define CTHREAD_H

#include "pthreads/pthread.h"

typedef void*(*ThreadCallback)(void*);

class CThread
{
	private:
		pthread_t m_thread;
		ThreadCallback m_ThreadFunc;

	public:
		CThread ( ThreadCallback ThreadFunc ) { m_ThreadFunc = ThreadFunc; };
		~CThread ( void ) { };

		int start ( void )								{ return pthread_create(&m_thread, NULL,  CThread::m_ThreadFunc, (void*) this); }
		int wait ( void )								{ return pthread_join(m_thread, NULL); }
		void exit ( void )								{ pthread_exit(NULL); }
};
#endif